const { AES_ECB, AES_CBC } = require('./index');

function main() {
  const keysize = 128;
  const key = '1122334455667788';
  const iv = 'aabbccddeeffgghh';
  const plain = 'hello';

  const aesECB = new AES_ECB(keysize, key);
  const resultECB = aesECB.encrypt(plain);
  const plainECB = aesECB.decrypt(resultECB);
  console.log('ECB 加密', resultECB);
  console.log('ECB 解密', plainECB);

  const aesCBC = new AES_CBC(keysize, key, iv);
  const resultCBC = aesCBC.encrypt(plain);
  const plainCBC = aesCBC.decrypt(resultCBC);
  console.log('CBC 加密', resultCBC);
  console.log('CBC 解密', plainCBC);
}

main();
